#pragma once

#include <QWidget>
#include "datatypedefine.h"
#include "publicgui_global.h"
#include <QDockWidget>
#include <QAbstractButton>

class QRadioButton;
class QComboBox;
class QSpinBox;
class QSlider;
class QVBoxLayout;
class QHBoxLayout;
class QButtonGroup;
class QPushButton;
class QStackedWidget;
class QListWidget;
class QTabWidget;
class QListWidgetItem;

namespace VrDataCore
{
	class TerrainBrushActor;
}

namespace PublicGui
{
	class PUBLICGUI_EXPORT VegetationWidget: public QWidget
	{
		Q_OBJECT
	public:
		VegetationWidget(VrDataCore::TerrainBrushActor* terrainbrush,QWidget *parent=0);
		~VegetationWidget();
		void refreshWidget();
	private:
		void buildList(QListWidget* listwidget,const QStringList& filelist,const QString& parentdir);
		VrDataCore::TerrainBrushActor*								_terrainBrush;
		QListWidget*												_treeListWidget;
		QListWidget*												_grassListWidget;
		QTabWidget*													_tabWidget;
		QSpinBox*													_densitySpin;
	private slots:
		void slotSpinChanged(int);
		void slotTabCurrentChanged(QListWidgetItem*);
	};

	class PUBLICGUI_EXPORT TerrainModifyWidget: public QDockWidget
	{
		Q_OBJECT
	public:
		TerrainModifyWidget(QWidget *parent=0);
		~TerrainModifyWidget();
	private:
		QComboBox*											_toolbox;
		QSpinBox*											_innerRadius;
		QRadioButton*										_circleTypeButton;
		QRadioButton*										_squareTypeButton;
		QSlider*											_sliderRadius;
		QMap<int,QWidget*>									_typeToSettingWidget;
		QButtonGroup*										_group;
		QStackedWidget*										_toolWidget;
		int													_inner;
		VrDataCore::TerrainBrushActor*						_terrainBrush;
		QRadioButton*										_currentTypeButton;

		void randomPosition(const osg::Vec3& center,float radious,int density,QVector<osg::Vec3>& posvec);
		void randomPosition(const osg::Vec3& min,const osg::Vec3& max,int density,QVector<osg::Vec3>& posvec);
		void setupChildWidget();
	public slots:
		void slotsToolTypeChanged(const QString& type);
		void slotsBrushShapeChanged(QAbstractButton*);
		void slotInnerBoxChanged(int inner);
		void slotInnerSliderChange(int inner);
		void slotDoBrush();
		void slotsCurrentMapChanged();
	signals:
		void signalBrushTypeChanged();
	};
}